home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
util
/
cli
/
rebootscript.lha
/
Rebootscript
/
WriteScript.S
< prev
Wrap
Text File
|
2000-08-24
|
3KB
|
131 lines
;******************************************************************************
; Write path, and reboot da machine.
; (Compiled with AsmPro V1.16d)
;
; Use this file f.ex: WriteScript dh0:Games/A/Arkanoid.bat
;
; (c) Per Johansson aka Olle^Omen / Latex, Craze, Planet Jazz, Massive
;
; omen@telia.com http://go.to/olle (2000-08-23)
;******************************************************************************
incdir Includes:
include Exec/Exec.I
include Exec/Exec_Lib.I
include Exec/types.i
include Exec/libraries.i
include Dos/Dos.I
include Dos/Dos_Lib.I
Start lea.l Pathbuffer,a1
moveq.l #0,d0
move.l #256-1,d7
.l tst.b (a0)
beq.w .q
move.b (a0)+,(a1)+
add.l #1,d0
dbra d7,.l
.q tst.b d0
beq.w .quit
subq.l #1,d0
move.l d0,PathLength
bsr.w Writepath
.quit rts
Writepath move.l #Savename,d1 ; Delete previous
bsr.w _Dos_Delete ; if needed.
move.l #Savename,d1
bsr.w _Dos_Openfile
move.l #Pathbuffer,d2 ; Write submitted path
move.l PathLength(pc),d3 ; to tempfile.
bsr.w _Dos_Write
bsr.w _Dos_Closefile
move.l #128,d1 ; Wait for hd, before reset
bsr.w _Dos_Delay
bsr.w Reset ; Reset
rts
; HWREF-Reset
Reset move.l $4.w,a6
cmp.w #36,LIB_VERSION(a6)
blt .oldexec
jmp -726(a6)
.oldexec lea.l .goaway(pc),a5
jsr _LVOSupervisor(a6)
rts
even
.goaway lea.l MAGIC_ROMEND,a0
sub.l MAGIC_SIZEOFFSET(a0),a0
move.l 4(a0),a0
subq.l #2,a0
reset
jmp (a0)
Xdef _Dos_Openfile
Xdef _Dos_Closefile
Xdef _Dos_Read
Xdef _Dos_Write
Xdef _Dos_Delete
Xdef _Dos_Execute
Xdef _Dos_Getsize
inclink .asm:lo/dos.lnk
;+----------------------------------------------------------------------------+
;| APrintf - Print's the string in a0 to stdout (could be pipe'd) |
;| |
;| In: A0 = String to print! |
;| |
;| Thrashes no registers |
;+----------------------------------------------------------------------------+
APrintf movem.l d0-d7/a0-a6,-(sp)
move.l a0,-(Sp) ; Save Textpointer
moveq.l #0,d0 ; Any version.
lea.l .PDosName(Pc),a1
CALLEXEC OpenLibrary
move.l d0,.PDosBase
beq.w .Fail
move.l (Sp)+,a0 ; Restore Textpointer
move.l a0,a1
moveq.l #0,d3 ; Calculate Size
.Srch tst.b (a0)+
beq.w .Fnd
addq.l #1,d3
bra.w .Srch
.Fnd move.l .PDosBase(Pc),a6
jsr _LVOOutput(a6) ; Get Stdout
move.l d0,d1 ; File (Stdout)
move.l a1,d2 ; Text pointer
jsr _LVOWrite(a6) ; (File=D1,Data=D2,Length=D3)
move.l .PDosBase(Pc),a1
CALLEXEC CloseLibrary
.Fail movem.l (sp)+,d0-d7/a0-a6
rts
.PDosBase dc.l 0
.PDosName dc.b 'dos.library',0
even
Savename dc.b 's:rebootscript.bat',0 ; Filename to read.
even
MAGIC_ROMEND = $01000000
MAGIC_SIZEOFFSET= -$14
PathLength dc.l 0
section buffers,bss_p
Pathbuffer ds.b 256